import React,{Component} from 'react'

export default class Demo08_ref_children extends Component {
  constructor(props){
    super(props);
    this.state = {
      opacity:1,
    }
  }

  componentDidMount(){
    console.log('组件挂载成功');
    setInterval(()=>{
      var opacity = this.state.opacity;
      opacity-=0.2;
      this.setState({opacity:opacity});
      if(opacity<0){
        this.setState({opacity:1});
      }
    },500)
  }

  render(){
    return (
        <div style={{opacity:this.state.opacity,fontSize:'0.28rem'}}>Hello React</div>
    )
  }

}